home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
graphics
/
aim2_51.arc
/
AIMMAN.DOC
< prev
next >
Wrap
Text File
|
1988-07-20
|
87KB
|
2,046 lines
06601030305800
F0110030
9[...................................................]011
Ç
AIM:ANOTHERIMAGEMANAGER
TheimageprocessingprogramAIMwasoriginallydevelopedforthe
ATARISTbyFransGroenandRobertdeVries.Sincethefirst
versionofAIMtheextensionofthispublicdomainimage
processingpackagehasbecomeajointeffortofanumberof
peoplefromtheDelftUniversityofTechnologyandtheUniversity
ofAmsterdam.EspeciallyPietVerbeeksuppliedmanylinearand
non-linearfilteringroutines,LucasvanVlietandBenVerwer
developedthefastmorphologicaloperations.AlsoGertvan
Antwerpen,DamirSudarandIgorWebersuppliedanumberof
routinestoAIM.
AIMrunsinhigh-resolutionandlow-resolutionmode.Themedium-
resolutionmodeisnotsupported.AIMhasbeenwrittenintheC-
languageusing.Thepurposeoftheprogramistoexperimentwith
digitalimageprocessing.
Userinterface
TheuserinterfaceofAIMconsistsof:
-GEMinterface.Operationsandparameterscanbeselectedby
meansofdialogboxesanddrop-downmenus.Achoicefromamenu
resultsinacommandwhichispassedtothecommandinterpreter.
Imagedisplayscanbemovedandsized.
-Commandinterpreter.Sequencesofcommandscanbeputtogether
inacommandfile.Whentheloggingison,commandswhichare
enteredarealsostoredinalogcommandfile.Acommandfilemay
becalledwithinanothercommandfileupto16levelsdeep.
Thecommandinterpreterhasahistoryhandlerwithsomeediting
facilities.
ImagesinAIM
FourimagememoriesareavailableinAIM.Theimagememoriesare
8bitwideandhaveamaximumsizeof65536pixels.Standardaim
imageshaveathesizeof256x256pixels.Theseimagememories
aredisplayedattheATARIscreen.Thewindowsaredesignated
with'A','B','C'and'D'.Thepositionofthewindowsis
obtainedfromasetupfile.Imagewindowscanbemovedandsized.
Acolourimageconsistsof4memorieswithamaximumof16384
pixelsrespectivelyfortheintensity,red,greenandbluesub-
images.Thismaximumsizeistheresultfromthecurrent1Mbyte
memoryrestrictionoftheAtariST.Whenthememoryincreases,
largercolourimagescouldbesupported.Standardaimcolour
imageshaveasizeof4times128x128pixels.Theyoccupythe
sameareaasangrey-valueimageofsize256x256.Mostofthe
(colour)imageoperationsareappliedtoallsub-imagesofa
Çcolourimage.Someimageoperations(gradx,grady,equal)are
performedontheintensitysub-imageofacolourimage.After
suchanoperationthered,greenandbluecolourvaluesare
updatedaccordingtothenewintensityvalue.
The8bitplanesofthegrey-valueimagescanalsobeusedas8
binaryimages.BinaryandCellularLogicoperationscanbe
performedonthesebitplanes.Thebitplanesarenumberedfrom1
to8.
Whenanimageisreadfromdiskall8bitplanesareread
simultaneously.Thesameholdswhenanimageiswrittentodisk.
Animageisdisplayedinthegrey-valuemodewhentheextension
is.IMandincolormodewhentheextensionis.COL.Thedisplay
ofcolorimagesisonlysupportedinthelow-resolutionmode.
AlsoDEGASandNeochromeimagescanbereadorwritten.Withthe
readcommandthesepicturesareconvertedto320x200grey-value
images.Withthecreadcommandtheyareconvertedtocolour
imagesofsize160x100.Whentheextensionis.PI1or.PI3a
DEGASfileisreadorwritten,whentheextensionis.NEOa
neochromefileisreadorwritten.Examplesaregivenin@democ4.
Greatcareshouldbetakenbystoringimagesindegasor
neochromeformat.Intheseformatsalimitednumberofgrey
valuesorcoloursisused(palette),soadrasticreductionof
informationtakesplace,whichlimitsthepossibilityoffurther
imageprocessing.Imagesarestoredinfullgreyorcolour
resolutionintheAIMformat.
Inthehighresolutionmodeastandardgrey-valueimageis
representedby256x256blackandwhitedots.(thereareonly2
greyvaluespossible:whiteandblack).Asigma-deltatechnique
isusedtoobtainalocaldensityofthedotsrepresentingas
goodaspossiblethegrey-valuesintheimage.Inabinary
display0givesablackdotand1awhitedot.
Inthelowresolutionmodeastandardgrey-valueimageis
representedby128x128pixelsin8grey-values.Againasigma-
deltatechniqueisusedtorepresentasgoodaspossiblethe
original256greyvalues.Asthestandardimageshaveasizeof
256x256pixels,inthelow-resolutionmodeonly1pixeloutof
each2x2pixelneighbourhoodisdisplayed.Inthedefaultbinary
low-resolutionmode(don1)ablackdotisdisplayedwhenall
pixelsofa2x2neighbourhoodare'0'andawhitedotis
displayedwhenallpixelsina2x2neighbourhoodare'1'.Inall
othercasesagreydotisdisplayed.
Astandardcolorimageisdisplayedin128x128pixelswith16
differentcolors.Anoptimumpaletteischosenforthecurrently
displayedimage.Sothepalettesofotherimagesarenolonger
correct.Thepaletteoftheimagewhichisontopisdisplayed.
Clickingonanotherwindowbringsitontopwiththecorrect
palette.
Ç
Standardgrey-valueimagesondisk(extension.IM)consistof256
linesof256pixels(unsignedcharacters)of1byte.Soanimage
consistsof65536bytesintotal.Thesequenceislinebyline
fromtoplefttobottomright.
Standardcolorimagesondisk(extension.COL)consistofa
sequenceof4sub-imagesof128linesof128pixels(unsigned
characters)of1byte.Thesub-imagesareintensity,red,green
andbluerespectively.
Whenanimagedoesnothaveastandardformataheaderisneeded
(extension.HD),describingtheimagewidthandheight.The
headerusedistheheaderoftheCentreforImageProcessing
DelftandisgivenintheAppendix.Whenanimageiswrittenin
theAIMformatalwaysaheaderiswritten.
Commandinterpreter
Itisnotnecessarytogivethecompletecommandname.The
smallestnumberofletterswhichgivesnoambiguityissuffi⑨
cient.
Itispossibletoedityourcommandsinasimpleway.Thedelete-
orbackspace-keydeletethelastcharacter.CONTROL-Xdeletesthe
wholeline.Asequenceofcommandswhichperformacertain
operationmaybegroupedtoacommandfileandstoredondisk.
Theextensionofcommandfilesis.AIM.Whentheloggingison
alltheenteredcommandsarestored.Whentheloggingisswitched
offalogcommandfileiswrittentodisc.
Commandfilesareexecutedbytyping@name(withouttheexten⑨
sion).Anewcommandfilecanbecalledfromacommandfileand
maybenestedupto16levelsdeep.Sotyping@command-file-name
insteadofacommandexecutesthecommand-file.ESCstopsthe
executionofacommandfileandaskstheusertogoonornot.
Defaultvaluesareusedwhenaparameterisnotgiven.Whenan
erroneousvalueofaparameterisgiven,thecommandinterpreter
asksforacorrectvalue.ESCstopsthisprocedureandreturnsto
thecommandinterpreter(AIMprompt).Ifinthiscaseareturnis
given,thedefaultvalueisused.Thisgivesthepossibilityto
askforaparametervaluewhenacommand-fileisexecuted,
insteadofusingafixedvalue.Inthecommandfileforinstancea
questionmark(?)canbeusedinsteadoftheparametervalueto
obtainthisfeature.
Aquestionmark(?)insteadofacommandgivesalistofall
availablecommands.
Astar(*)indicatesthattheremainderofthecommandline
consistsofcomments.
9[....................................................]001
History
Ç
ThehistorymechanisminAIMisintendedtoresembleasmuchas
possibletheUNIXmechanism.Exceptforthe'history'commandmost
importantfeatureshavebeenincluded.
!!:repeatlastcommand.Itispossibletotypeextracharacters
afterthe!!.Theseareappendedafterthepreviousline.
!{chars}:repeatthecommandthatstartedwith{chars}.
!<n>:repeatthen-thcommandwithnisaninteger.Incasethenumber
isnegativethen-thpreviouscommandisrepeated.Ifsome
charactersfollowtheintegernumber,theseareappended.
^<string1>^<string2>^<string3>:replace<string1>intheprevious
commandwith<string2>,append<string3>andrepeatthechanged
command.
Examples:
Intheexamplestheprompthastheformof'aim'followedbyan
integernumberfollowedby'>'.
Thefirstcommandisasample.
aim1>readftrui
Nowlet'srepeatit.
aim2>!!
readftrui
Anotherwaytorepeatit.
aim3>!rea
readftrui
Youcanalsoappendtextafterthepreviouscommand.
aim4>!!.im
readftrui.im
Repeatfirstcommand.
aim5>!1
readftrui
Repeatthecommandofaim4>
aim6>!-2
readftrui.im
Changetruiintocermet.
aim7>^trui^cermet
readfcermet.im
ChangecermetintoketelandputimageinB.
aim8>^cermet^ketel^,B
readfketel.im,B
GEM-INTERFACE
Operationsmarkedwithastar(*)areonlyavailableinthe
commandinterpreter.
Dialogboxes
Parametersareenteredinthedialogboxesbyfirstpushingthe
ESCbuttontodeletethedefaultvalueandtogotothefirst
position.Onlyatthefirstpositionminussignsareallowed.
Therearetwospecialdialog-boxes.Oneisforthethreshold
command.Thedefaultthresholdvalueiscomputedeachtimeanew
input-imageisselected.
ÇTheotherspecialboxisforthepalette.Ifacolorischosen
thecolorcoefficientsareshownintheeditabletextline
underneath.Ifthecoefficientsarechangedandanyothercolor-
boxisclickedtheeffectofthechangesarevisible.Thethree
coefficientsrepresentthered,greenandblue,andmayvaryfrom
0to7.Highervaluesarecastto7.
Printerdriver
Printeroutputcanonlybedoneinmonochromemode.Thisis
becausetheactualscreenimageisprinted.Theprinterdriver
supports8pinand24pingraphics.InthefileAIM.INFafter
'printer'theprinterdefinitionisplaced.Firstthenameofthe
printerisgivenonasingleline.Afterthatthenumberofdots
andfinallytheprintercodestoresettheprinter,tosetthe
linedistanceandfinallytostartgraphicsprinting.
Tomakeaprinterdriverforyourownprinteryouonlyneedatext
editortocreateit.Thefirstlinecontainsthenameofyour
printer.Thesecondlinegivesthenumberofverticaldotsper
line.Itlookslike:
dpl8
"dpl"isakeywordfor"dotsperline"anditisseparatedbythe
valuebyaspace.Theonlyvaluessupportedatthismomentare8
and24.
Thethirdlinegivestheresetcodeforyourprinter.Itlooks
like:
reset1B40
"reset"isakeywordfortheresetcode.Thecharactersinthe
resetcodearegiveninhexadecimalseperatedbyaspace.The
maximumnumberofcharactersinthecontrolsequenceis20.
Thefourthlinegivesthecontrolsequencetosetthelinedistance
betweentwolinesofgraphicaloutput.Itlookslike:
linedist1B4108
"linedist"isthekeywordforthelinedistancecontrolsequence.
Itcanbe20characterslong.
Thelastlinegivesthecontrolsequencetostartgraphical
output.Itlookslike:
graphics1B4B
"graphics"isagainakeyword.Thesequencetostartprinting
graphicsisalwaysfollowedbythenumberofcolumnsofdotstobe
printed.Inmostprintersthisisdonebysendingfirstthelow
bytefollowedbythehighbyteofthewordthatcontainsthis
number.OtherprinterssendthenumberinBCDformat.InAIMonly
thefirstwayissupported.
üOPERATIONSINAIMÇ
FILEOPERATIONS
readf[ile]:readsanimagefromdisk.
Thefirstcommandparameteristheimagename,thesecond
optionalparameteristheimagememory(A,B,C,D).Defaultis
ÇimagememoryA.Theextensionofangrey-valueimagefileis.IM.
Availablestandardimagesare:TRUI.IM,CERMET.IM,TUD.IMand
ASBEST.IM.Whennoextensionisgiven.IMisassumed.
(Whentheextensionis.COLacolourimageisreadin).
Whennoheaderfileispresentastandardimagesizeisassumed,
otherwisethedescriptionfromtheheaderfileisused.
Whentheextensionis.PI1or.PI3aDEGASfileisconvertedtoa
grey-valueimageof320x200pixels.Whentheextensionis.NEO
aneochromefileisconvertedtoagrey-valueimageof320x200
pixels.
command:readfimage-file,image
default:readftrui,A
range:-,<A-D>
creadf[ile]:readsacolourimagefromdisk.
Thefirstcommandparameteristheimagename,thesecond
optionalparameteristheimagememory(A,B,C,D).Defaultis
imagememoryA.
Theextensionofacolorimageis.COL.Availablecolorimages
are:MANDRIL.COL,MAID.COL,GIRL.COLandARLES.COL.
Whennoextensionisgiven.COLisassumed.
(Whentheextensionis.IMagrey-valueimageisreadin).
Whennoheaderfileispresentastandardimagesizeisassumed.
otherwisethedescriptionfromtheheaderfileisused.
Whentheextensionis.PI1aDEGASfileisconvertedtoacolour
imageof160x100pixels.Whentheextensionis.NEOaneochrome
fileisconvertedtoacolourimageof160x100pixels.
command:creadfimage-file,image
default:creadfmandril,A
range:-,<A-D>
writf[ile]:writesanimagetodisk.
Thefirstcommandparameteristheimagememory(A,B,C,D).The
secondparameteristhenameoftheimage-file.Whennoextension
isgiven.IMisassumed.Besidestheimagefilealsoaheader
fileiswritten(extension.HD).Theheaderstructureisgivenin
theAppendix.
Whentheextensionis.PI1or.PI3aDEGASfileiswritten.When
theextensionis.NEOaneochromefileiswritten.
command:writfimage,image-file
default:writfA,dummy
range:<A-D>,<anything>
Çloadsetup
Thiscommandloadsasetupfile.Thesetupfiledescribesthe
pathoftheimagefiles(read/write),thecommandfiles,the
helpfiles,theaspectandalign-flagsandthepositionofthe
windows.
savesetup
Thiscommandsavesthecurrentsettings(pathsandwindow
positions)inasetupfiles.
Macro:selectsandstartsacommandfile.
@filenameisacommandfile.An@startsthecommandfile.
Commandfilesmaybenestedupto16levels.Anexampleisgiven
in@demo.Theextensionofcommandfilesis.AIM.Theseexten⑨
sionsareaddedtothecommandfilenamebyAIM.
Wheninfinite=-1thecommandfileisinfinitelyrepeated.
command:@name.AIM,infinite
default:-,0
range:-,<-1,0>
Logging
Whentheloggingisonallenteredcommandsarestored.Whenthe
loggingisswitchedoff,thestoredcommandsarewritteninalog
file.Inthiswayautomaticallycommandfilescanbecreated.
printpic:printsapicture.
Thiscommandprintsthecontentsofawindow.Itonlyworksin
highres.Ifahistogramornumbersaredisplayedinawindowitis
alsoprinted.Thesecondparameteristhemagnificationfactor.
Whena24-dotmatrixprinterisinstalledtheresultlooksbetter
withmagnificationfactor2.
command:printpicim,factor
default:printpicA ,1
range:<A-D>,<1,5>
exit:endstheprogram.Thisactioncanalsobeobtainedby
typingControl-Corbyclickingtheclose-boxofthecommand-
window.
command:exit
TESTIMAGEGENERATION
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
shad:shadingimagegenerator
ÇShad generates a shadinglike grey image.Thegreyvalueisthe
sumofthebilinearinterpolation of the corner points b a
c d
and the quadratic (e*x*(1-x) + f*y*(1-y))*N/128
ife+f>0,N = (255-(a+b+c+d)/4),
such that e=f=256 -> 255-(a+b+c+d)/4 as maximumoutput
ife+f<0,N = ( (a+b+c+d)/4),
such that e=f=-256 -> -(a+b+c+d)/4 as minimumoutput
command:shadout_im,a, b,c,d,e,f
default:shad B ,255 0 , 0 , 0 , 0, 0
range:<A-D>,<0,255>,<-255,255>
GEOMETRICANDARITHMETICGREY-VALUEOPERATIONS
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
GEOMETRICGREYVALUEOPERATIONS
copy:copiesorsamplesanimage.
Thefirstcommandparameteristheinputimage,thesecondis
theoutputimage(A,B,C,D).Extraparametersallowsamplingthe
inputimagewhichisvirtuallyrepeatedinalldirections
(periodic).Thethirdandfourthparameterarethesampling
startingpositionX,Yandallowwrapping(Xwith-signenforces
theinverseoperation,Yalsowith-signenforceswritewithout
clear(stamping));thefifthandsixgivethe2Dsamplingstep
dx,dytakenintheinputimagewhenwritingalineintheoutput
image;theseventhandeightharethe2DsamplingstepDX,DY
takenwhenfeedingalineintheoutputimage.Inverse sampling
(-X)at2**kstepsizemultiply overwritesallcopyingresultsbut
thatofthe lower right block,whichisthusblowntodots.
Differentparameterchoices:
|
typeofsampling | X Y dx dy DX DY
copy (1) (1) (1) (0) (0) (1)(default)
smearline31 1 31 1 0 0 0
smearcolumn17 17 0 0 0 0 1
wrap 17,31->1,1 17 31 (1) (0) (0) (1)
reduce 2x hor 1 1 2 0 0 1
reduce 3x ver 1 1 1 0 0 3
reduce 2xhor&ver 1 1 2 0 0 2
skew up 1 1 1 1 0 1
skew left 1 1 1 0 1 1
skew right 1 1 1 0 -1 1
reflect hor 256 1 -1 0 0 1
reflect ver 1 256 1 0 0 -1
upside down 256 256 -1 0 0 -1
transpose 1 1 0 1 1 0
symmetr. ri half 256 1 -1 0 0 1 out=in
symmetr. lo half 1 256 1 0 0 -1 out=in
pointsymlo half 256 256 -1 0 0 -1 out=in
tilt atan 1 = 45 127 127 1 1 -1 1
Çtilt atan-1 =-45 127 127 1 -1 1 1
tilt atan-2 127 127 1 -2 2 1
tilt atan-1/2 127 127 2 -1 1 2
inverse ofthis -127 127 2 -1 1 2
blowtodots -1 1 4 0 0 4
command:copyinput_image,out_im,X, Y,dx,dy,DX,DY
default:copy A, B , 1 1 1 0 0 1
range:<A-D>,<A-D>,<-256,256>
ARITHMETICGREYVALUEOPERATIONS
Standardandsignedgreyvalues.
Thestandardarithmeticgreyvalueoperationshavebeenbuiltfor
greyvaluesintherangeof0to255.Someinterestingimage
processingresultssuchasgradientsmaybenegative.InAIMsuch
resultsarerepresentedbysilentlyadding127(integer255/2).
Ineffectanewkindofgreyvalues,"signedgreyvalues",witha
rangeof-127to128issodefined.Arithmeticwithsignedgrey
valuesasksforaseparatesetofsignedarithmeticcommands.
Theyaresimilartothenormalcommandsbutforaprefix"s"and
willnotbeseparatelydescribed."sadd"doesnotexistasitis
identicalto"add","sginva"isidenticalto"scmula-1".
MONADICGREYVALUEARITHMETIC
cadd:addsaconstanttoanimage.
Thefirstcommandparameteristheinputimage.Thesecond
parameteristheconstantwhichisadded.Thethirdparameteris
theoutputimage.Ifnooutputimageisspecifiedtheoutput
overwritestheinput.
output_image=input_image+constant
command:caddinput_image,constant,output_image
default:caddA,0 , input_image
range:<A-D>,<-255,255>,<A-D>
ginv:subtractstheimagefrom255
Thefirstcommandparameteristheinputimage.Thesecond
parameteristheoutputimage.Ifnooutputimageisspecified
theoutputoverwritestheinput.
output_image=255-input_image
command:ginvinput_image,output_image
default:ginvA, input_image
range:<A-D>,<A-D>
cabs:determinesabsolutedifferencewithaconstant
Ç
Thefirstcommandparameteristheinputimage.Thesecond
parameteristheconstant.Thethirdparameteristheoutput
image.Theresultisclippedabove255.Ifnooutputimageis
specifiedtheoutputoverwritestheinput.
output_image=|input_image-constant|
command:cabsinput_image,constant,output_image
default:cabsA,0 , input_image
range:<A-D>,<-255,255>,<A-D>
cmul:multipliesanimagebyaconstant.
Thefirstcommandparameteristheinputimage.Thesecond
parameteristhemultiplicationconstant.Thethirdparameteris
theoutputimage.Ifnooutputimageisspecifiedtheoutput
overwritestheinput.
output_image=input_image*constant
command:cmulinput_image,constant,output_image
default:cmulA,1 , input_image
range:<A-D>,<0,255>,<A-D>
cdiv:dividesanimagebyaconstant.
Thefirstcommandparameteristheinputimage.Thesecond
parameteristhedivisionconstant.Thethirdparameteristhe
outputimage.Ifnooutputimageisspecifiedtheoutput
overwritestheinput.
output_image=input_image/constant
command:cdivinput_image,constant,output_image
default:cdivA,1 , input_image
range:<A-D>,<1,255>,<A-D>
(*)clear:clearsanimage.
Clearsetseachpixelvalueintheimageto0.
command:clearimagedefault:clearArange:
<A-D>(*)assign:assignsaconstanttoeachpixelinanimage.
command:assignimage,constant
default:assignA,0
range:<A-D>,<0,255>
DYADICGREYVALUEARITHMETIC
Ç
add:addstwoimages.
Thefirstcommandparameteristhefirstinputimage,thesecond
parameteristhesecondinputimage,thethirdparameteristhe
outputimage.Ifnooutputimageisspecifiedtheoutput
overwritesthesecondinput.
output_image=(input1_image+input2_image)/2
command:addinput1_image,input2_image,output_image
default:addA,B , input2_image
range:<A-D>,<A-D>,<A-D>
sub:subtractstwoimages.
Thefirstparameteristhefirstinputimage,thesecond
parameteristhesecondinputimage.Thethirdparameterisa
constantwhichcanbeaddedtothedifference.Thefourth
parameteristheoutputimage.Astheimagecannotbecome
negative,theresultingvalueisclippedbelow0andabove255.
Ifnooutputimageisspecifiedtheoutputoverwritesthesecond
input.
output-image=(input1_image-input2_image)+constant
command:subinput1_image,input2_image,constant,output-image
default:subA,B,0,input2_image
range:<A-D>,<A-D>,<-255,255>, <A-D>
abs:givesabsolutedifferenceoftwoimages.
Thefirstparameteristhefirstinputimage,thesecond
parameteristhesecondinputimage.Thethirdparameterisa
constantwhichcanbeaddedtothedifference.Thefourth
parameteristheoutputimage.Theresultingvalueisclipped
above255.Ifnooutputimageisspecifiedtheoutputoverwrites
thesecondinput.
output-image=|input1_image-input2_image+constant|
command:absinput1_image,input2_image,constant,output-image
default:absA,B,0,input2_image
range:<A-D>,<A-D>,<-255,255>, <A-D>
mul:multipliestwoimages.
Thefirstparameteristhefirstinputimage,thesecond
parameteristhesecondinputimage.Thethirdparameterisa
constantbywhichtheproductcanbedivided.Thefourth
parameteristheoutputimage.Theresultingvalueisclipped
Çabove255.Ifnooutputimageisspecifiedtheoutputoverwrites
thesecondinput.
output-image=(input1_image*input2_image)/constant
command:mulinput1_image,input2_image,constant,output-image
default:mulA,B,256,input2_image
range:<A-D>,<A-D>,<1,32767>, <A-D>
div:dividestwoimages.
Thefirstparameteristhefirstinputimage,thesecond
parameteristhesecondinputimage.Thethirdparameterisa
constantbywhichthequotientcanmultiplied.Thefourth
parameteristheoutputimage.Theresultingvalueisclipped
above255.Ifnooutputimageisspecifiedtheoutputoverwrites
thesecondinput.
output-image=(input1_image/input2_image)*constant
command:divinput1_image,input2_image,constant,output-image
default:divA,B,1,input2_image
range:<A-D>,<A-D>,<0,32767>, <A-D>
TRIADICGREYVALUEARITHMETIC
mud:multipliestwoimagesanddividesbyathirdimage.
Thefirstparameteristhefirstinputimage,thesecond
parameteristhesecondinputimage.Thethirdparameteristhe
thirdinputimagebywhichtheproductisdivided.Thefourth
parameteristheoutputimage.Theresultingvalueisgiven
modulo255.Ifnooutputimageisspecifiedtheoutputoverwrites
thesecondinput.
output-image=(input1_image*input2_image)/input3_image
command:divinput1_image,input2_image,input3_image,output-image
default:divA,B,C,input3_image
range:<A-D>,<A-D>,<A-D>,<A-D>
♪①DYADICGREYVALUENON-ARITHMETIC
(*)minimum:minimumoftwoimages.
Thefirstcommandparameteristhefirstinputimage,thesecond
parameteristhesecondinputimage,thethirdparameteristhe
outputimage.Ifnooutputimageisspecifiedtheoutput
overwritesthesecondinput.
Çoutput_image=minimum(input1_image,input2_image)
command:minimuminput1_image,input2_image,output_image
default:minimumA,B , input2_image
range:<A-D>,<A-D>,<A-D>
(*)maximum:maximumoftwoimages.
Thefirstcommandparameteristhefirstinputimage,thesecond
parameteristhesecondinputimage,thethirdparameteristhe
outputimage.Ifnooutputimageisspecifiedtheoutput
overwritesthesecondinput.
output_image=maximum(input1_image,input2_image)
command:maximuminput1_image,input2_image,output_image
default:maximumA,B , input2_image
range:<A-D>,<A-D>,<A-D>
(*)sminimum:signedminimumoftwostandardimages.
Thisoperationisapplicabletostandard,nottosignedgrey
values.Theoutputissigned.Thefirstcommandparameteristhe
firstinputimage,thesecondparameteristhesecondinput
image,thethirdparameteristheoutputimage.Theresulting
valueisclippedbelow0andabove255.Ifnooutputimageis
specifiedtheoutputoverwritesthesecondinput.
if(input1_image<input2_image)
output_image=127+input1_image
else
output_image=127-input2_image
command:sminimuminput1_image,input2_image,output_image
default:sminimumA,B , input2_image
range:<A-D>,<A-D>,<A-D>
(*)ssminimum:signedminimumoftwoimages.
Thisoperationisapplicabletosigned,nottostandardgreyvalues.
Theoutputissignedtoindicate.Thefirstcommandparameteristhefirst
inputimage,thesecondparameteristhesecondinputimage,the
thirdparameteristheoutputimage.Theresultingvalueis
clippedbelow0andabove255.Ifnooutputimageisspecified
theoutputoverwritesthesecondinput.
if(input1_image<input2_image)
output_image=input1_image
else
output_image=254-input2_image
Ç
command:ssmaximuminput1_image,input2_image,output_image
default:ssmaximumA,B , input2_image
range:<A-D>,<A-D>,<A-D>
TRIADICGREYVALUENON-ARITHMETIC
(*)mindev:takeinputvaluewithminimumdeviation.
Theoutputpixelvalueisthatvalueoftheinput1orinput2
images,thatdifferstheleastfromtheinput3pixelvalue.Ifno
outputimageisspecifiedtheoutputoverwritesinput3.
if|input3value-input1value|<|input3value-input2value|
output=input1
else
output=input2
command:mindevinput1_im,input2_im,input3_im,output-im
default:mindevA,B,C,input3_im
range:<A-D>,<A-D>,<A-D>,<A-D>
GREY-VALUEFILTERS
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Apixelvalueintheoutputimageisdeterminedbythevalueof
thepixelintheinputimagetogetherwiththepixelvaluesina
localneighbourhoodaroundthepixel.Bothlinearandnon-linear
operationscanbeappliedtosuchaneighbourhood.InAIMthe
neighbourhoodsareeitherfixedsizeandfixedshape:3x3
square,orvariablesizeandshape.
Indicatinghorizontalby-,verticalby|andthediagonalsby/
and\avariablefilterofsizescanhavedifferentshapes:
size-x1|(shape=0or4),size/x1\(shape=1or5),size|x
1-(shape=2or6),size\x1/(shape=3or7),size-xsize|
(square,shape=8),size/xsize\(diamond,shape=9),andin
somecasesapproximatelyroundringswithdiameters(shapes10-
17).
APPLICATIONS
Differenttasksinimageprocessingcanbedefined.Eachtaskcan
beperformedbydifferentfilters.Themaintasksare
1.maketheimagelesssharp("smoothing")
2.representslopestrength("gradient")
3.extractdetail("detail")
4.enhancedetail("crispening")
5.extractedgesorhighcontrastareas("edge")
6.findlocalextrema("min","max")
SURVEYGREYFILTERS
ǯ¯¯¯¯¯¯¯|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
|non-adaptiveadaptive|
| linear non-linear |
size||
&shape|fixedvariablefixedvariable|
|-------------------------------------------------------|
smooth|gaussuniformmediandyttet-kuwahara|
|lgauss|
|adne,adre|
||
gradient|gradx,ylgradientxxxxkugradien*
|ggradient|
|sune,sure|
||
detail|laplaceparabolapeakdygtegragvanefilte*
|dogori-smoothori-smoothdystesras|
||
crisp|filter(df)ori+detailhavedyftefrafori+detail
|ori+detail|
||
contrast|robertslgradient8-dyrterrar-|
/edge|haradyltelral-|
||
min|contrast-detail-lminlow-|
max|contrast+detail-lmaxupp-|
||
general-|filterseparablex---edgps|
purpose|(+recurs)|
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*notyetimplemented;dfdefault;ximpossible;-absent.
IMPLEMENTATION
Separablefilters.Filtersthatcanbereplacedbyaone-
dimensionalfilteringofeachimagelinefollowedbyaone-
dimensionalfilteringofeach(resulting)columnarecalled
separable.Theyworkonarectangularorsquareneighbourhood.
Examplesarethelinear'uniform'filterandthenon-linear
'l(ocal)maximum'filter.InAIMthisseparationhasbeenexploi⑨
tedtospeedupvariablesizefiltering.Theone-dimensional
filtersusedcanalsobeappliedonebyonealonghorizontal,
verticalandbothdiagonaldirections.Combiningdiagonaldirec⑨
tionsyieldsadiamondneighbourhood.
Sum-of-separablefilters.Thesumoftwoseparablefilters
withoutacommonone-dimensionalcomponentbelongtoaspecial
classofnon-separablefilters.InAIMtheirconstructionfrom
one-dimensionalfiltersissometimesbutnotalwaysused.Exam⑨
plesarethenon-linear'dyt'(dynamicthreshold)andthelinear
'laplace',respectively.InAIManot-separatedfilterisalways
afixedsize3x3filteroritsrepeatedversion(e.g.'dog',
differenceofgaussians).Inprincipleanylinearfilterisasum
ofseparablefilters,tobefoundbysingularvaluedecomposi⑨
tion.ThishasnotbeenimplementedinAIM.Alsootherfunctions
oflinearfiltersmayoccur,likethemaximumofabsolutevalues
Çinthe2-Dl(ocal)gradient(alaRoberts).Non-separable
filters.Somenon-linearfiltersarenotknowntobereducibleto
one-dimensionalfilters.Anexampleisthe'median'filter.
LINEAR,FIXEDSIZE&SHAPE
Alinearfiltercanberealizedbymultiplyingapixelandits
neighbourhoodbycoefficients.Theresultisthesumofthese
multiplica-tionsandiscalledaconvolution.Examplesoflinear
filtersarethe'gauss','gradient'and'laplace'filters.
InAIMthesizeoflinearfiltersislimitedtoa3x3neighbour⑨
hood.'Filter'isarotation-symmetrical3x3filterofwhichthe
coefficientscanbespecifiedbytheuser.Inthe'gauss',
'gradient'and'laplace'filtersthecoefficientsarefixed.
Thecoefficientsare:
121-10-1-1-2-10-10
242-20-2000-14-1
121-10-1-1-2-10-10
gaussx-gradienty-gradientlaplace
cdchvcd0-10001010100100
chvccchv-15-1000-1000000-10
cdchvcd0-10-10000000-1000
filter(default)grad/3grad/2grad\3grad\2
---------------roberts-----------------
gauss:linearfilterforsmoothing.
Thefirstparameteristheinput-image(defaultA)andthe
secondparameteristheoutput-image(defaultB).Thefiltering
canberepeated(size-1)/2-1moretimesandthenemulatesasize
xsizebinomialfilter,anapproximationoftheactualgauss
filter.
Thethirdparameteristhesize(2n+2=2n+1,default3).
output-image=gauss(gauss(gauss...(gauss(input-image))...))
command:gaussinput-image,output-image,size
default:gaussA,B,3
range:<A-D>,<A-D>,<3-255>
gradx:horizontal"Sobel"gradientfilter.
Thefirstparameteristheinput-image(defaultA)andthesecond
parameteristheoutput-image(defaultB).Theoutput-imagemay
bemultipliedbyafactor(multiply/1024)andaconstant(add)
maybeaddedtotheresult.
output-image=gradx(input-image)*(multiply/1024)+add
command:gradxinput-image,output-image,multiply,add
Çdefault:gradxA,B,1024,128
range:<A-D>,<A-D>,<1-10000>,<-255-255>
grady:vertical"Sobel"gradientfilter.
Thefirstparameteristheinput-image(defaultA)andthesecond
parameteristheoutput-image(defaultB).Theoutput-imagemay
bemultipliedbyafactor(multiply/1024)andaconstant(add)
maybeaddedtotheresult.
output-image=grady(input-image)*(multiply/1024)+add
command:gradyinput-image,output-image,multiply,add
default:gradyA,B,1024,128
range:<A-D>,<A-D>,<1-10000>,<-255-255>
enhance:linearfilterforimagedetailenhancement.
Thisisthepreviouslaplaceoperation.Thefirstcommand
parameteristheinput-imageandthesecondparameteristhe
output-image.Defaultsare:Afortheinput-imageandBforthe
output-image.
command:enhanceinput-image,output-image
default:enhanceA,B
range:<A-D>,<A-D>
nlaplace:linearfilterforimagedetailextraction.
Thefirstcommandparameteristheinput-imageandthesecond
parameteristheoutput-image.Defaultsare:Afortheinput-image
andBfortheoutput-image.
command:nlaplaceinput-image,output-image
default:nlaplaceA,B
range:<A-D>,<A-D>
dog:differenceofgaussians,linearfilterforimagedetail
extraction.
Thefirstcommandparameteristheinput-imageandthesecond
parameteristheoutput-image.Defaultsare:Afortheinput-
imageandBfortheoutput-image.Thethirdandfourthparameters
thearesizesofthelargestandsmallestgauss(binomial)filter
(2s+2=2s+1,defts.3,1).
output-image=gauss(input-image,s)-gauss(input-image,l)+127
command:doginput-image,output-image,largel,smalls
default:dogA,B,3,1(original)
range:<A-D>,<A-D>,<3,255>,<1,sl-1>
Çroberts:3x3or2x2Robertsgradientfilter.
Thefirstparameteristheinput-image(defaultA)andthesecond
parameteristheoutput-image(defaultB).Thethirdparameter
indicatessize3x3(3,default)or2x2(2).
output-image=pointmaximum(abs(grad/),abs(grad\))
command:gradxinput-image,output-image,size
default:gradxA,B,3
range:<A-D>,<A-D>,<2-3>
filter:generalpurpose3x3rotation-symmetricalfilter.
Thisfilterperformsageneral3x3rotation-symmetricalconvolu⑨
tion.Parametersaretheinput-image,theoutput-imageandthe3
differentcoefficientsina3x3neighbourhood.Thecoefficientof
thecentralpixeliscc,thecoefficientsofthehorizontaland
verticalneighboursarechvandthecoefficientsofthediagonal
neighboursarecd.Thedefaults(5,-1,0)arechosensoasto
givethecrispsum'original+laplace'.
Theresultmaybemultipliedbyafactor(multiply/1024)anda
constant(add)maybeaddedtotheresult.
output-image=filter(input-image)*(multiply/1024)+add
command:filterinput-image,output-image,cd,chv,cc,multiply,add
default:filterA,B,0,-1,5,2048,0
range:<A-D>,<A-D>,<-/+1000>,<10000>,<-+255>
LINEAR,VARIABLESIZE&SHAPE
Forevensizetheresultisshiftedover1/2pixelwithrespect
tothefiltercenter.
unif:linearfilterforsmoothing.
Thisfilterdeterminesforeachpixeltheaverageofalocal
neighbour-hoodintheinput-image.Thisaveragebecomesthepixel
valueintheoutput-image.
Thefirstparameteristheinput-image,thesecondparameteris
theoutput-image.Thethirdparameteristhesizeofthelocal
neighbourhood.Thissizeisavaluebetween1and127.Thefourth
parameteristheshape:0,4=-;1,5=/;2,6=|;3,7=\;8=+,9=X.
Roundshapeshavenotyetbeenimplemented.
command:unifinput-image,output-image,neighbourhoodsize,shape
default:unifA,B,3,8
range:<A-D>,<A-D>,<1,63>,<0,9>
lgau:linearfilterforsmoothing.
Ç
Thisfilterdeterminesforeachpixeltheweightedaverageofa
localneighbourhoodintheinput-image.Thebinomialcoefficients
areusedasweights.Thisaveragebecomesthepixelvalueinthe
output-image.
Thesquareversionisfarbetterisotropicthansquareunif.
Thefirstparameteristheinput-image,thesecondparameteris
theoutput-image.Thethirdparameteristhesizeofthelocal
neighbour-hood.Thissizeisavaluebetween1and63.Thefourth
parameteristheshape.Roundshapesarenotneededandhavenot
beenimplemented.
command:lgauinput-image,output-image,neighbourhoodsize,shape
default:lgauA,B,3,8
range:<A-D>,<A-D>,<1,63>,<0,9>
adne:linearfilterforsmoothing.
Thisfilteraddstoeachpixelintheinput-imagethevalue(or
halforaquarteretc.)ofitsleftneighbour(ifshape=0)inthe
input-image.Thesum(orincaseofoverflowsum-256)becomesthe
pixelvalueintheoutput-image.Thefirstpixelofeachline(if
shape=0)iscopiedunprocessed.Thefirstparameteristheinput-
image,thesecondparameteristheoutput-image.Thethird
parameterindicateswhichpartoftheneighbourisadded:0->
full,1->half,2->quarter,k->1/(2**k),7->1/128.Thefourth
parameteristheshapeandalsotheFreemandirection.0->E(ast),
1->NE,2->N,3->NW,4->W,5->SW,6->S,7->SE.
2-Dfiltersarecombinedfromthese:8->0,2,4,6;9->1,3,5,7.
Noroundshapes."adne"istheexactinverseof"sure".
command:adneinput-image,output-image,neighbourpart,shape
default:adneA,B,0,0
range:<A-D>,<A-D>,<0,7>,<0,9>
adre:recursivelinearfilterforsmoothing.
Thisfilteraddstoeachpixelintheinput-imagethevalue(or
halforaquarteretc.)ofitsleftneighbour(ifshape=0)inthe
output-image.Thesum(orincaseofoverflowsum-256)becomes
thepixelvalueintheoutput-image.Thefirstpixelofeachline
(ifshape=0)iscopiedunprocessed.Thefirstparameteristhe
input-image,thesecondparameteristheoutput-image.Thethird
parameterindicateswhichpartoftheneighbourisadded:0->
full,1->half,2->quarter,k->1/(2**k),7->1/128.Thefourth
parameteristheshapeandalsotheFreemandirection.0->E(ast),
1->NE,2->N,3->NW,4->W,5->SW,6->S,7->SE.2-Dfiltersare
combinedfromthese:8->6,4,2,0;9->7,5,3,1.Noroundshapes.
"adre"istheexactinverseof"sune".
command:adreinput-image,output-image,neighbourpart,shape
Çdefault:adreA,B,0,0
range:<A-D>,<A-D>,<0,7>,<0,9>
lgra:lineargradientfilter.
Thisfilterdeterminesforeachpixeltheslopeaofthebestfit
firstdegreepolynomial(ax+b)overalocalneighbourhoodinthe
input-image.Thisslopebecomesthepixelvalueintheoutput-
image;normallyitisscaledsothatthelargeststepup(0000
255255255255)producesoutput127+127,thelargeststepdown
127-127.Thefirstparameteristheinput-image,thesecond
parameteristheoutput-image.Thethirdparameteristhesizeof
thelocalneighbour-hood.Thissizeisavaluebetween1and127.
A-signenforcesexactslopescaling.Thefourthparameteristhe
shape.2-Dshapes(square8,diamond9)givemaximumofabsolute
slopesalaRoberts(8->0,2;9->1,3).Noroundshapes.
command:lgrainput-image,output-image,neighbourhoodsize,shape
default:lgraA,B,3,8
range:<A-D>,<A-D>,<1,127>,<0,9>
ggra:lineargradientfilter.
Thisfilterisequivalenttolgaufollowedbysune(full
subtraction).Thefirstparameteristheinput-image,thesecond
parameteristheoutput-image.Thethirdparameteristhesizeof
thelocalneighbour-hood.Thissizeisavaluebetween1and127.
Thefourthparameteristheshape.2-Dshapes(square8,diamond
9)givemaximumofabsoluteslopesalaRoberts(8->0,2;9->1,3).
Noroundshapes.
command:ggrainput-image,output-image,neighbourhoodsize,shape
default:ggraA,B,3,8
range:<A-D>,<A-D>,<1,127>,<0,9>
sune:lineargradientfilter.
Thisfiltersubtractsfromeachpixelintheinput-imagethe
value(orhalforaquarteretc.)ofitsleftneighbour(if
shape=0)intheinput-image.Thesum(orincaseofunderflowsum
+256)becomesthepixelvalueintheoutput-image.Thefirst
pixelofeachline(ifshape=0)iscopiedunprocessed.Thefirst
parameteristheinput-image,thesecondparameteristheoutput-
image.Thethirdparameterindicateswhichpartoftheneighbour
issubtracted:0->full,1->half,2->quarter,k->1/(2**k),7->
1/128.ThefourthparameteristheshapeandalsotheFreeman
direction.0->E(ast),1->NE,2->N,3->NW,4->W,5->SW,6->S,7-
>SE.2-Dfiltersarecombinedfromthese:8->0,2,4,6;9->1,3,5,7.
Noroundshapes."sune"istheexactinverseof"adre"andeven
compensatesitsoverfloweffects.
Çcommand:suneinput-image,output-image,neighbourpart,shape
default:suneA,B,0,0
range:<A-D>,<A-D>,<0,7>,<0,9>
sure:recursivelineargradientfilter.
Thisfiltersubtractsfromeachpixelintheinput-imagethe
value(orhalforaquarteretc.)ofitsleftneighbour(if
shape=0)intheoutput-image.Thesum(orincaseofunderflow
sum+256)becomesthepixelvalueintheoutput-image.Thefirst
pixelofeachline(ifshape=0)iscopiedunprocessed.Thefirst
parameteristheinput-image,thesecondparameteristheoutput-
image.Thethirdparameterindicateswhichpartoftheneighbour
issubtracted:0->full,1->half,2->quarter,k->1/(2**k),7->
1/128.ThefourthparameteristheshapeandalsotheFreeman
direction.0->E(ast),1->NE,2->N,3->NW,4->W,5->SW,6->S,7-
>SE.2-Dfiltersarecombinedfromthese:8->6,4,2,0;9->7,5,3,1.
Noroundshapes."sure"istheexactinverseof"adne"andeven
compensatesitsoverfloweffects.
command:sureinput-image,output-image,neighbourpart,shape
default:sureA,B,0,0
range:<A-D>,<A-D>,<0,7>,<0,9>
para:lineardetailextractingfilter.
Thisfilterdeterminesforeachpixelthecoefficientaofthe
bestfitseconddegreepolynomial(ax2+b)overalocalneighbour⑨
hoodintheinput-image.Thiscoefficientbecomesthepixelvalue
intheoutput-image;normallyitisscaledsothatthelargest
trough(2552552550...0255255255255)producesoutput
127+127,thelargestridge127-127.Thefirstparameteristhe
input-image,thesecondparameteristheoutput-image.Thethird
parameteristhesizeofthelocalneighbourhood.Thissizeisa
valuebetween1and127.A-signenforcesexactcoefficient
scaling.Thefourthparameteristheshape.2-Dshapes(square8,
diamond9)givemaximumofabsoluteslopesalaRoberts(8->0,2;
9->1,3).Noroundshapes.
command:lgrainput-image,output-image,neighbourhoodsize,shape
default:lgraA,B,3,8
range:<A-D>,<A-D>,<1,127>,<0,9>
sepa:generalpurposelinearfilter
This routine performs a one-dimensional filtering; thefirst
parameter(filter)type can be min=0,max=1,unif=2,
lgau(=binom)=4,adne(=add neighb)=10,adre(=recursive adne)=12,
lgra(=linfit)=6,sune(=sub neighb)=11,sure(=recursive sune)=13,
para(=quadfit)=8,recu(=3point recursive filtering)=14,defined
as out=b0*in+b1*in_1+b2*in_2-a1*out_1-a2*out_2-a3*out_3.
Thesecondandthirdparameterareinputandoutputimage.The
fourthparameteris f(ilter)size, even size gives 1/2 pixelwrap-
Çped outputin the f(ilter)dir(ection) indicated by thefifthpa-
rameter; fdir can be 0=E(astwd),1=NE,2=N,3=NW,4=W,5=SW,6=S,7=SE;
thesixththrougheleventhparametersareb0,b1,b2,a1,a2,a3.
diagonal scanning goes as follows:
SE scan xsize = 10, ysize = 8
11 * 7 = 77
1 8 15 22 29 36 43 50 57 64
71 2 58
65 72 3 52
59 73 4 46
53 74 5 40
47 75 6 27 34
41 76 7 14 21 28
35 42 49 56 63 70 77 - - -
SW scan xsize = 10, ysize = 8
9 * 9 = 81
18 9 18 55 46 37 28 19 10 1
- 2 11
66 3 52
58 4 46
50 5 40
42 6 27 34
34 7
26 17 8 17 - -
command:sepatype,in-im,outim,fsize,fdir,a1,a2,a3,b0,b1,b2
default:sepa2,A,B,3,0,0,0,0,0,0,0
range:<0,14>,<A-D>,<A-D>,<-127,127>,<0,7>,<-127,127>
out=b0*in+b1*in_1+b2*in_2-a1*out_1-a2*out_2-a3*out_3
NON-LINEARFILTERS
Non-linearfiltersperformimageoperationswhichareimpossible
withlinearfilters.Noisecanbesuppressedwithanon-linear
filterwithoutdeterioratingedgesinanimage.Themedian
filter,Schlag'speakfilter,thelocalminimumandmaximum
filtersandtheirrelatives(themax/minfamilyincludingthe
PAPSdynamicthreshold"dyt"andtheLee-Haralickedgefilter
"dyl"and"hara")areimplementedinAIM.
NON-LINEARFIXEDSIZE&SHAPE
medi:medianfilter.
Themedianfilterdeterminesforeachpixelthemedian(the
Çmiddle)valueofalocal(3x3)neighbourhoodintheinput-image.
Thismedianvaluebecomesthepixelvalueintheoutput-image.
Thisfiltersuppressesnoise.
Thefirstparameteristheinput-image,thesecondparameteris
theoutput-image.
command:mediinput-image,output-image
default:mediA,B
range:<A-D>,<A-D>
peak:ridgefindingfilter.
Thepeakfilter(JohnSchlag)determinesforeachpixelifitis
a1-Dmaximumalongthe-,/,|and\direction.Ifthisistrue
for"num"ormoredirectionsandifthepixelvalueisabove
"thresh"theoutputpixelisgiventhevalue"val"else0.
Thefirstparameteristheinput-image,thesecondparameteris
theoutput-image,thethirdparameteristhenumberofdirections
inwhichthepixelmustbemaxinorderthatitmaybepeak,the
fourthparameteristhethresholdabovewhichthepixelcanbe
peak,thefifthparameteristhevaluewrittenatpeakpositions.
command:peakinput-image,output-image,number,thresh,value
default:peakA,B ,2 ,0,255
range:<A-D>,<A-D>,<0,4>,<0,255>,<0,255>
(*)hara:non-linearedgefilter.
Thefilterharaperformsavariant(LucasvanVliet)ofthe3x3
Lee-Haralickedgefilter(Patt.Rec.Conf.,Paris'86).
Thisfilterisbasedupontheweighteddifferencebetweenthe
originalimageandthelocalminimumandlocalmaximumfiltered
images.
Thefirstcommandparameteristheinput-imageandthesecond
parameteristheoutput-image.Defaultsare:Afortheinput-
imageandBfortheoutput-image.
command:harainput-image,output-image
default:haraA,B
range:<A-D>,<A-D>
(*)have:non-linearlaplacelikefilter.
Thefilterhaveperformsanon-linearlaplacelike-likeoperation
inspiredbythe3x3Lee-Haralickedgefilter(Patt.Rec.Conf.,
Paris'86).
Addingthehaveresulttotheoriginalgivessharpeningasinthe
linearlaplacefilter.
Thisfilterisbasedupontheweighteddifferencebetweenthe
Çoriginalimageandthelocalminimumandlocalmaximumfiltered
images.
Thefirstcommandparameteristheinput-imageandthesecond
parameteristheoutput-image.Defaultsare:Afortheinput-
imageandBfortheoutput-image.
command:haveinput-image,output-image
default:haveA,B
range:<A-D>,<A-D>
NON-LINEAR,VARIABLESIZE&SHAPE
lmin:localminimumfilter.
Theminimumfilterdeterminesforeachpixeltheminimumofa
localneighbourhoodintheinput-image.Thisminimumbecomesthe
pixelvalueintheoutput-image.Thisoperationresultsinan
extensionofthedarkpartsinanimage.Thisoperationisalso
calledgrey-valueerosion.
Thefirstparameteristheinput-image,thesecondparameteris
theoutput-image.Thethirdparameteristhesizeofthelocal
neighbourhood.Thissizeisavaluebetween1and127.Thissize
isavaluebetween1and127.Thefourthparameteristheshape:
0,4=-;1,5=/;2,6=|;3,7=\;8=+;9=X;10=sparsecircularcordon;
11=10+centre;12=10stamping;13=11stamping;14=circularring;15=14+
centre;16=14stamping;17=15stamping.Theoperationisillustrated
in@demo5and@demo7.
command:lmininput-image,output-image,neighbsize,shape
default:lminA,B,3 ,8
range:<A-D>,<A-D>,<1,127> , <0,17>
lmax:localmaximumfilter.
Themaximumfilterdeterminesforeachpixelthemaximumofa
localneighbourhoodintheinput-image.Thismaximumbecomesthe
pixelvalueintheoutput-image.Thisoperationresultsinan
extensionofthebrightpartsofanimage.Thisoperationisalso
calledgrey-valuedilation.
Thefirstparameteristheinput-image,thesecondparameteris
theoutput-image.Thethirdparameteristhesizeofthelocal
neighbourhood.Thissizeisavaluebetween1and127.Thefourth
parameteristheshape:0,4=-;1,5=/;2,6=|;3,7=\;8=+,9=X;
10=sparsecircularcordon;11=10+centre;12=10stamping;13=11stamping;
14=circularring;15=14+centre;16=14stamping;17=15stamping.
command:lmaxinput-image,output-image,neighbsize,shape
default:lmaxA,B,3 ,8
range:<A-D>,<A-D>,<1,127> , <0,17>
MAX/MINFAMILY
Allfiltersinthemax/minfamilyarecombinationsoflmaxand
Çlminfilters,thesizeandshapeofwhichcanbespecified.The
inputimageisalwaysA,theoutput-imagealwaysB.
IntermediateresultsarestoredinC(mostcases)andinD(many
cases).Duetotheconcatenationoffilterstepstheeffective
sizeofthetotalfilterwillbecorrespondinglylarger.
low:lowerenvelopefilter
Thelowerenvelopefilterremovessmallpeaksandfollowssmooth
ramps.Itconsistsoflminfollowedbylmax:low=lmax(lmin).
command:lowinput-image,output-image,neighbsize,shape
default:lowA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
upp:upperenvelopefilter
Theupperenvelopefilterremovessmalldipsandfollowssmooth
ramps.Itconsistsoflmaxfollowedbylmin:upp=lmin(lmax).
command:uppinput-image,output-image,neighbsize,shape
default:uppA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
dyt:dynamicthresholdfilter
Thedynamicthresholdfilter(Bernsen,PhilipsPAPS)isanon-
linearsmoothingfilterthatprovidesalocalthresholdinshaded
images.Applyingitasathresholdbringsoutdetail.Itconsists
oftheaverageoflminandlmax:dyt=(lmin+lmax)/2.
command:dytinput-image,output-image,neighbsize,shape
default:dytA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
tet:texturethresholdfilter
Thetexturethresholdfilterisanon-linearsmoothingfilter
thatprovidesalocalthresholdinshadedimageswhilefollowing
ramps.Applyingitasathresholdbringsouttexturedetailbut
norampdetail.Thereisnolinearequivalentforthis.The
filterconsistsoftheaverageoflowandupp:
tet=(low+upp)/2.Noiseishandledastexture:reducedbytet.
command:tetinput-image,output-image,neighbsize,shape
default:tetA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
dyg:dynamicgistfilter
Thedynamicgist(=essence)filterisanon-lineardetail
extractingfilter.Itsubtractsthedynamicthresholdfromthe
original.WhilePAPSdynamicthresholdinggivesthesignofthe
differenceasabinaryoutput,dyggivesthedifferenceasgrey
Çvalueoutput:dyg=ori-dyt.
command:dyginput-image,output-image,neighbsize,shape
default:dygA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
teg:texturegistfilter
Thetexturegist(=essence)filterisanon-lineartexturedetail
extractingfilterthatignoresrampdetail.Thereisnolinear
equivalentforthis.Thefiltersubtractsthetexturethreshold
fromtheoriginal:teg=ori-tet.Noiseishandledastexture:
extractedbyteg.
command:teginput-image,output-image,neighbsize,shape
default:tegA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
rag:rampgistfilter
Therampgist(=essence)filterisanon-linearrampdetail
extractingfilterthatignorestexturedetail.Thereisnolinear
equivalentforthis.Thefiltersubtractsthetexturegistfrom
thetotaldynamicgist:rag=dyg-teg.Noiseishandledas
texture:reducedbyrag.Fornoisyimagesragisbetterthandyg.
command:raginput-image,output-image,neighbsize,shape
default:ragA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
dyl:dynamicLeeedgefilter
TheLee-Haralick-Shapirofilterisanon-linearedgefilter.It
givestheabsolutedifferenceoftheoriginalwiththelocal
minimumorthelocalmaximum,whicheverissmallest:
dyl=pmin(lmax-ori,ori-lmin).
command:dylinput-image,output-image,neighbsize,shape
default:dylA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
tel:textureLeeedgefilter
ThisvariantoftheLee-Haralick-Shapirofilterisanon-linear
textureedgefilter.Itgivestheabsolutedifferenceofthe
originalwiththelowerorupperenvelope,whicheverissmallest:
tel=pmin(upp-ori,ori-low).Atrampsthesedifferencesareboth
small.Noiseishandledliketexture:extractedbytel.
command:telinput-image,output-image,neighbsize,shape
default:telA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
Çral:rampLeeedgefilter
ThisvariantoftheLee-Haralick-Shapirofilterisanon-linear
rampedgefilter.Itgivestheabsolutedifferenceofthelocal
minimumwiththelowerenvelopeortheabsolutedifferenceofthe
localmaximumwiththeupperenvelope,whicheverissmallest:
ral=pmin(lmax-upp,low-lmin).Atrampsthesedifferencesare
bothsmall.Noiseishandledliketexture:reducedbyral.In
noisyimagesralisbetterthandyl.
command:ralinput-image,output-image,neighbsize,shape
default:ralA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
dys:dynamicsignedLeefilter
hisvariantoftheLee-Haralick-Shapirofilterisanon-linear
detailextractingfilter.Unlikedyg(andlinearlaplace)it
representsdetailbyverysharpextremes.Startingoutfromdyl
onegetsdysbyaddingthesign:+iforiginalnearertolocal
maximum,-ifnearertominimum:dys=smin(lmax-ori,ori-lmin).
command:dysinput-image,output-image,neighbsize,shape
default:dysA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
tes:texturesignedLeefilter
ThisvariantoftheLee-Haralick-Shapirofilterisanon-linear
texturedetailextractingfilter.Thereisnolinearequivalent
forthis.Unliketegitrepresentsdetailbyverysharpextremes.
Startingoutfromtelonegetstesbyaddingthesign:+if
originalnearertoupperenvelope,-ifnearertolowerenvelope:
tes=smin(upp-ori,ori-low).Atrampsthesedifferencesareboth
small.Noiseishandledliketexture:extractedbytes.
command:tesinput-image,output-image,neighbsize,shape
default:tesA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
ras:rampsignedLeefilter
ThisvariantoftheLee-Haralick-Shapirofilterisanon-linear
rampdetailextractingfilter.Thereisnolinearequivalentfor
this.Unlikeragitrepresentsdetailbyverysharpextremes.
Startingoutfromralonegetstesbyaddingthesign:+iflocal
maximumnearertoupperenvelope,-iflocalminimumnearerto
lowerenvelope:ras=smin(lmax-upp,low-lmin).Attexturethese
differencesarebothsmall.Noiseishandledliketexture:
reducedbyras.Innoisyimagesrasisbetterthandys.
command:rasinput-image,output-image,neighbsize,shape
default:rasA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
Çdyf:dynamicfrontLeefilter
ThisvariantoftheLee-Haralick-Shapirofilterisanon-linear
crispeningfilter.Edgesareshapedintosteps.Likeadding
linearlaplaceherenon-lineardysisaddedtotheoriginal:
dyf=ori+dys.
command:dyfinput-image,output-image,neighbsize,shape
default:dyfA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
tef:texturefrontLeefilter
ThisvariantoftheLee-Haralick-Shapirofilterisanon-linear
texturecrispeningfilter.Textureedgesareshapedintosteps.
Thereisnolinearequivalentforthis.Likeaddingdysheretes
isaddedtotheoriginal:
tef=ori+tes.Atrampstesissmall.Noiseishandledlike
texture:extractedbytef.
command:tefinput-image,output-image,neighbsize,shape
default:tefA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
raf:rampfrontLeefilter
ThisvariantoftheLee-Haralick-Shapirofilterisanon-linear
rampcrispeningfilter.Textureedgesareshapedintosteps.
Thereisnolinearequivalentforthis.Likeaddingdyshereras
isaddedtotheoriginal:
raf=ori+ras.Attexturerasissmall.Noiseishandledlike
texture:reducedbyraf.Innoisyimagesrafisbetterthandyf.
command:rafinput-image,output-image,neighbsize,shape
default:rafA,B,3 ,8
range:<A>,<B>,<1,127> , <0,17>
ADAPTIVEFILTERS
Typically,adaptivefiltersarecompositesofsimplelinearor
non-linearfilters.Theireffectisusuallynon-linear.Asimple
examplewouldbeanX-rayenhancerthatappliescrispeningin
lightareasonly:onesmoothingfilter"tastes"thegreyvalueof
areas,theresultisusedtocontrolasteerablecrispening
filter.Moreingeneral,severaltastingfiltersmaycollect
informationtransformedbyacontrolruleintoacontrolsignal
vectorthatsteersasteerableactingfilter,(e.g.aweighted
filterbank).
edgps:flippingneighbourhoodmechanism
VanAntwerpenintroducedthismechanismaspivotalpartofhis
versionofKuwaharaedgepreservingsmoothing(kuwainAIM).It
canbeusedtogeneralizethekuwafilter.Thefirstparameteris
Çafilteredimage.Thesecondparameterisanimagethatcontains
thetastedinformation.Thethirdparameteristheoutputimage.
Foreachoutputpixelthemechanisminspectsthecornersofanxn
square(nisthefourthparameter,usuallyequaltothesizeof
thefiltersusedtoproducetheinputimages)aroundit(giving
thefifthparameter(c)anon-zerovalueenforcesadditional
inspectionofthecenterposition)andselectstheonewithleast
tastedvalue.Thevalueofthefilteredimageattheselected
positioniswrittenastheoutputresult.Themechanismmimicks
thechoicebetweentheresultsoffour(fiveifc!=0)acting
filters(withasneighbourhoodstheupperleft,upperright,
lowerleftandlowerrightquadrantwithrespecttotheoutput
pixel,andalsoacenteredsquareifc!=0).Thischoicemay
changefromonepositiontothenext:aflippingneighbourhood.
Forevenntheoutputpositionhasan1/2,1/2offsetthatwill
compensatetheoffsetsofthefiltersused,iftheyareSouthand
Eastoriented(asisdefaultinAIM).
command:edgpsfilt'd-im,tasted-im,output-im,size,center-on
default:edgpsA,B,filt'd-im,3 ,0
range:<A-D>,<A-D>,<A-D>,<2,255>,<-255,255>
kuwa:edgepreservingsmoothingfilter
Hachimura&Kuwaharaproposedtheflippingneighbourhoodin
combinationwithavariancefilterastastingfilterandwith
uniformsmoothingasactingfilter.Areasthatcontainanedge
havinglargervariancethanothersareavoidedinthesmoothing.
Henceedgesarepreserved.InAIM(accordingtoVanAntwerpen)
thedynamicrange(lmax-lmin)istastedratherthanvariance.
Thefirstparameteristheinputimage,thesecondisa
temporaryimageusedasscratch,thethirdistheoutputimage.
Thefourthparameteristhesizeofthesmoothingandtasting
filters(evensizesallowed).Thefifthparameterifnon-zero
extendsthefourquadrantschoicebyacentersquare(seeedgps).
command:kuwainput-im,temp-im,output-im,quadrantsize,center-on
default:kuwaA,B,C,3 ,0
range:<A-D>,<A-D>,<A-D>,<2,15>,<-255,255>
GREY-VALUEPOINTOPERATIONS
equal(ization):histogramequalization.
Thisoperationreassignsthegrey-valuesinanimageandresults
inan"optimum"useoftheavailablegrey-values.Thegrey-value
histogramoftheoutputimageisasflataspossible(giventhe
necessaryrequantization).Anexampleisgivenin@demo1.
command:equalinput-image,output-image
default:equalA,B
range:<A-D>,<A-D>
Ç
table:transformsagreyvalueimageusingalook-uptable.
Thegreyvaluegfromtheinputimage(firstparameter)isused
astableaddress,thecontentfoundtherebecomesthegreyvalue
hintheoutputimage(secondparameter).Severaltablescanbe
generated(thirdparameter,t;examplesaregivenin@demtable):
t=0:h=g**(j/k);t=2:h=(k/g)**j;
t=1:h=(j/k)**g;j=0->j/k=e;t=-1:h=log(g)/log(j/k);
t=3:h=atan(k*(g-gj));t=-3:h=tan(g-j)/k+gj;
t=4:g=(x+8)+16*(y+8)->h=phi*16/2pi+16*r;t=-4:inverseoft=4;
t=5:h=cos(g**j*k*2pi);t=-5:h=sin(g**j*k*2pi);
t=6:j=lower,k=higherthreshold;t=-6:8thresholdsj,j+1,,j+7;
t=7:h=log(g+1)-log(256-g);t=-7:h=-1+257/(1+exp(-g));
t=8:h=((j/k)**g+(j/k)**-g)/2 -1;|t=-8:h=(log(g+1+sqrt((g+1)**2-1)))
j=0 -> j/k=e ;| /log(j/k); j=0 -> j/k=e.
t=-8: inverse cosh-1, sqrt at low g,h but log at high g,h:
pseudo Weber-Fechner law of human visual sensitivity
Fourthpara.(r)reflectstable:r=1:normal;r=2:g->-g;r=3:h->
-h;r=4:g->-g,h->-h;r=5:g->|g|;r=6:g->|g|,h->|h|*sgn(g).
thresh[olding]:transformsagrey-valueimageinabinaryimage.
Thebinaryimageisobtainedbythresholdingtheinputimage.
Afterthresholdingbinaryimageoperationsmaybeapplied.Pixels
withagrey-valueabovethethresholdgetthebinaryvalue'1'
andthusbecomewhite.Pixelswithagrey-valuebelowthe
thresholdgetthebinaryvalue'0'andbecomeblack.Thedefault
valueofthethresholdisobtainedfromthegrey-valuehistogram
withthemethodofRidler&Calvert.
command:threshinput-image,output-image,bitplane,threshold
default:threshA,B,1,automatic
range:<A-D>,<A-D>,<1,8>,<0,255>
mcop:transformsabinaryimageintoagrey-valueimage.
mcopallowsabinaryimagewantedtotakepartingreyoperations
tobecopiedtoallbitplanesofagreyimage(1->255).Amask
wordmayrestrict"all"tosome:e.g.255->all,37->only1,3,6.
Notethattheremainingbitplaneswillnotbereset.
command:mcopinput-image,output-image,input-bitplane,mask
default:mcopA,B,1,255
range:<A-D>,<A-D>,<1,8>,<0,255>
CELLULARLOGIC(BINARY)OPERATIONS
Theseoperationscanbeappliedtothe8bitplanesofanimage.
Thebitplanesarenumberedfrom1to8.Ablackpixelhasthe
value'0',awhitepixelhasthevalue'1'.
Theedgevalueoftheimagecanbesetto'0'or'1'inall
Çoperations.Thedefaultvalueoftheimageedgeisblack(0).The
givennumberofiterationsisamaximum.Theiterationsstopwhen
nochangesinthepixelvaluesoccuranymore.
Thenumberofiterationsisshowninthatcase.
erosion:erodeswhiteobjects.
Onelayerofthewhiteobjectsispeeledoffineachiteration.
Whiteobjectswhicharesmallerthanthenumberofiterations*2
willdisappear.Theconnectivitydetermineswhichwhitepixels
belongtoalayertobepeeledoff.Whentheconnectivityis4
thislayerconsistsofthosewhitepixelsthathaveahorizontal
orverticalblackneighbour.Whentheconnectivityis8alayer
consistsofthosewhitepixelsthathaveahorizontal,vertical
ordiagonalblackneighbour.Whentheconnectivityis6forthe
odditerationsa4-connectivityisusedandfortheeven
iterationsan8-connectivityisused.Theerosionisillustrated
in@demo6.
command:erosion#iterations,bitplane,connectivity,edge,image
default:erosion1,1,6,0,B
range:<1,512>,<1,8>,<4,6,8>,<0,1>,<A-D>
dilation:extendswhiteobjects.
Onelayerisaddedtothewhiteobjectsineachiteration.Black
partssuchasholeswhicharesmallerthanthenumberof
iterations*2willdisappear.Theconnectivitydetermineswhich
blackpixelsbelongtoalayertobeadded.Whentheconnectivity
is4thislayerconsistsofthosewhitepixelsthathavea
horizontalorverticalwhiteneighbour.Whentheconnectivityis
8alayerconsistsofthoseblackpixelsthathaveahorizontal,
verticalordiagonalwhiteneighbour.Whentheconnectivityis6
fortheodditerationsa4-connectivityisusedandfortheeven
iterationsan8-connectivityisused.
command:dilation#iterations,bitplane,connectivity,edge,image
default:dilation1,1,6,0,B
range:<1,512>,<1,8>,<4,6,8>,<0,1>,<A-D>
propag[ation]:dilatesabitplaneunderamask.
Thepropagationstronglyresemblesthedilation.However,the
blackpixelsareonlyaddedwhentheyarewhite(1)inthemask
bitplane.Thepropagationcanbeusedtofindtheoriginalshapes
ofobjectswhichremainedafteranumberoferosioniterations.
Thisapplicationisalsoshownin@demo6.
Thefirstparameteristhenumberofiterations.Thesecond
parameteristhebitplaneofwhichthedilationtakesplace(seed
bitplane).Thethirdparameteristhemaskbitplane.Theother
parametersareagaintheconnectivityandtheimageedgevalue.
Whentheedgevalueis0onlytheseedbitplaneispropagated.
Whentheedgevalueis1onlytheedgeispropagatedandwhenthe
edgevalueis2boththeedgeandtheseedbitplaneare
Çpropagated.
command:propag#iterations,bitplane,maskbitplane,connectiv,
edge,image
default:propag1,1,2,6,0
,A
range:<1,512>,<1,8>,<1,8>,<4,6,8>
,<0,2>,<A-D>
skelet:skeletonwithendpixels.
Theskeletonisan1pixelthicklineinthemiddleofwhite
objects.Theskeletonoperationresemblestheerosion,butin
thiscasepixelsofalayerareonlydeleted,whentheirdeletion
doesnotchangethetopologyoftheimage.(Theyarenotbreak
pixels).Anadditionalrestrictionisthatapixelmaynotbe
deletedattheendofaskeleton(line).Thenumberofiterations
mustbesufficientlylargetofindthecompleteskeleton(the
biggestdiameterofthewhiteobjectsdividedby2).
Theoperationstopswhenthenumberofiterationsisreachedor
whennopixelschangeanymore.Anexampleisgivenin@demo3.
command:skelet#iterations,bitplane,edgevalue,image
default:skelet100,1,0,B
range:<1,512>,<1,8>,<0,1>,<A-D>
-skelet:skeletonwithoutendpixels
Theskeletonwithoutendpixelsisthesameastheprevious
skeletonoperation,butendpixelsmaybedeletedinthiscase.
Solidobjectswillresultinsinglepixelsandholesinobjects
willresultinrings.Thisisillustratedbytheskeletonofthe
background(exo-skeleton)in@demo4.
command:-skelet#iterations,bitplane,edgevalue,image
default:-skelet100,1,0,B
range:<1,512>,<1,8>,<0,1>,<A-D>
contour:determinesthecontoursofobjects.
Theresultistheedgesofwhiteobjects.Thismeansallwhite
pixelswithoneormoreblackneighbours.
command:contourbitplane,edgevalue,image
default:contour1,0,B
range:<1,8>,<0,1>,<A-D>
majority:performsamajorityvoting.
Thecentralpixelofa3x3neighbourhoodbecomesblackorwhite
dependinguponthemajorityoftheneighbourhood.
command:majoritybitplane,edgevalue,image
default:majority1,0,B
Çrange:<1,8>,<0,1>,<A-D>
remove[noise]:removespepperandsaltnoise.
Awhitepixelinacompleteblack3x3neighbourhoodbecomes
black.Ablackpixelinacompletewhite3x3neighbourhood
becomeswhite.
command:removebitplane,edgevalue,image
default:remove1,0,B
range:<1,8>,<0,1>,<A-D>
life:gameoflife
Thewell-knowngameoflifeisalsoacellularlogicoperation!
command:life#iterations,bitplane,edgevalue,image
default:life1,1,0,B
range:<1,512>,<1,8>,<0,1>,<A-D>
SPECIALLINEFIGUREPIXELS
sinpix[els]:determinesisolatedwhitepixels
Thesewhitepixelshavenowhiteneighbourina3x3neighbour⑨
hood.
command:sinpixbitplane,edgevalue,image
default:sinpix1,0,B
range:<1,8>,<0,1>,<A-D>
endpix[els]:determinesendpixelsofalinefigure.
Thesewhitepixelshaveonlyonewhiteneighbourina3x3
neighbourhood.
command:endpixbitplane,edgevalue,image
default:endpix1,0,B
range:<1,8>,<0,1>,<A-D>
linkpix[els]:determineswhitepixelswithtwowhiteneighbours.
Thesewhitepixelshavetwowhiteneighboursina3x3neighbour⑨
hood.
command:linkpixbitplane,edgevalue,image
default:linkpix1,0,B
range:<1,8>,<0,1>,<A-D>
vertices:determinestheverticesinalinefigure.
Thesewhitepixelshavemorethantwowhiteneighboursina3x3
Çneighbourhood.
command:verticesbitplane,edgevalue,image
default:vertices1,0,B
range:<1,8>,<0,1>,<A-D>
BITOPERATIONS
bcopy:copiesabitplane.
Thecommandparametersaretheinput-bitplaneandtheoutput-
bitplane.
command:bcopybitplanein,bitplaneout,imagein,imageout
default:bcopy1,3,B,B
range:<1,8>,<1,8>,<A-D>,<A-D>
and:AND-functionoftwobitplanes.
Thecommandparametersaretheinput-bitplanesofwhichtheAND-
functionistakenandtheoutput-bitplane.
command:andbitplanein1,bitplanein2,bitplaneout,image
default:and1,2,2,B
range:<1,8>,<1,8>,<1,8>,<A-D>
or:OR-functionoftwobitplanes
Thecommandparametersaretheinput-bitplanesofwhichtheOR-
functionistakenandtheoutput-bitplane.
command:orbitplanein1,bitplanein2,bitplaneout,image
default:or1,2,2,B
range:<1,8>,<1,8>,<1,8>,<A-D>
exor:EXOR-functionoftwobitplanes
Thecommandparametersaretheinput-bitplanesofwhichtheEXOR-
functionistakenandtheoutput-bitplane.
command:exorbitplanein1,bitplanein2,bitplaneout,image
default:exor1,2,2,B
range:<1,8>,<1,8>,<1,8>,<A-D>
invert:invertsabitplane
Thefirstcommandparameteristhebitplane.Thesecondcommand
parameteristheimage.
command:invertbitplane,image
default:invert1,B
range:<1,8>,<A-D>
Ç
set:setsabitplane,somakesitwhite(1).
Thefirstcommandparameteristhebitplane.Thesecondcommand
parameteristheimage
command:setbitplane,image
default:set1,B
range:<1,8>,<A-D>
reset:resetsabitplane,somakesitblack(0).
Thefirstcommandparameteristhebitplane.Thesecondcommand
parameteristheimage.
command:resetbitplane,image
default:reset1,B
range:<1,8>,<A-D>
label:labelsconnectedcomponents.
Thiscommandlabelstheconnectedcomponentswithinabinary
image.Themaximumnumberoflabelsis255.(Inlowresolution
thebestdisplayisobtainedby:don,3followedbybdisp.)
command:input-image,output-image,inputbitplane,connectivity
default:B,A,1,8
range:<A-D>,<A-D>,<1-8>,<4,6,8>
UTILITIES
(*)don:Automaticdisplayon
Whentheautomaticdisplayison,aftereachoperationtheresult
isshown.
Anoptionalparametergivesthetypeofdisplayinthelow-
resolutionmode.Anexampleisgivenin@democ5.
0:displayoff(sameasdoff)
1:Whenallpixelsofa2x2neighbourhoodintheoriginal
bitplaneare'0'ablackdotisdisplayed.Whenallpixelsofa
2x2neighbourhoodinthebitplaneare'1'awhitedotis
displayed.Inallothercasesagreydotisdisplayed.
2:ThebitplaneissampleddependingupontheGEMwindowsize.
Whenthefirstpixelofasampleregionis'0'ablackdotis
displayed.Whenthefirstpixelis'1'awhitedotisdisplayed.
3:Multiplebitplanedisplay.Bitplanesaresampleddepending
upontheGEMwindowsize.Bitplane1isdisplayedinred,bitplane
2inblueandbitplane3ingreen.Whenallthreelowest
bitplanesare'0',the3highestbitplanesareshownasgrey-
Çvalue.
4:Multiplebitplanedisplay.Bitplanesaresampleddepending
upontheGEMwindowsize.Bitplane8isdisplayedinred,bitplane
7isdisplayedinblueandbitplane6isdisplayedingreen.
command:don,display_type
default:don,1
range:don,<0,4>
(*)doff:Automaticdisplayoff
Whentheautomaticdisplayisoff,onlyanimageisdisplayed
afteragdisporbdispcommand.
command:doff
(*)ton:Timeron
Theexecutiontimeofeachcommandisdisplayedwhenthetimeris
on.
command:ton
(*)toff:Timeroff
Setstimeroff.
command:toff
gdisp:Grey-value/colordisplayofanimage.
Thisroutinedisplaysagrey-valueimageas256x256blackor
whitedotsinhighresolution.Inlowresolution128x128pixels
of8grey-valuesaredisplayed.Imagesarealwaysdisplayedwith
maximumcontrast.Thecontrastiscomputedfromthe0.1*promille
percentileofthehistogram.
Whentheimageisacolorimageitisdisplayedincolorinthe
lowresolutionmode.Whenthecdisp_typeparameteris0anoptimal
paletteiscomputed.Whentheparameteris2asigma/delta
techniqueforredgreenandbluedotsisused.Whentheparameter
is1,redandbluearedisplayedwithdots,greenisdisplayedin
4values.
Thefirstparameteristheimage(AtoD).
command:gdispimage,promille,cdisp_type
default:gdispA,previous,0
range:<A-D>,<0-100>,<0-2>
bdisp:Displaysoneofthe8bitplanesofanimage.
Firstcommandparameteristheimage(defaultA).Secondparame⑨
teristhebitplane(default1).Inhighresolutionblackor
whitepixelsaredisplayed.Thetypeofdisplayinlowresolution
Çisdeterminedbythe(optional)donparameter.
command:bdispimage,bitplane
default:bdispA,1
range:<A-D>,<1,8>
hist:calculatesthehistogramofanimage.
Thehistogramisdisplayedinoverlayintheappropriateimage
window(AtoD).Athresholdiscalculatedfromthehistogramto
segmenttheimage(forthethreshcommand).Thecommand
parameteristheimage(defaultA).
command:histimage
default:histA
range:<A-D>
Palette:Changethepaletteinteractively.
Thisoptionisonlysupportedinthelow-resolutionmode.
Preferences:Changepreferences.
Whentheimagewindowsaresized,theaspectsratiocanbe
preservedornot.
Theimagescanbealignedtobyteboundariesornot.
help:giveshelpinformation.
command:helpcommand
APPENDIX:Fileheaderstructure
/*calltheheaderfile*.hd,thisfilecontainsthestructure
withallparametersofthecorrespondingimagefile*.im.*/
typedefstruct
{
short*address;/*image_addressinmemory*/
charname[16];/*nameoftheimagefile*/
shortformat;/*format*/
shortsizex;/*dimension1*/
shortsizey;/*dimension2*/
shortsizez;/*dimension3*/
unsignedshortcommsz;/*sizeofcommentinbytes*/
shortdata[16];/*userimagedependentdata*/
}
HEADER;
#defineF_WORDS0/*formatwordsintheimage*/
#defineF_BYTES1/*formatbytesintheimage*/
#defineF_FOBIT2/*fourbitsimage,packedin4pix/word*/
#defineF_TWBIT3/*twobitsimage,packedin8pix/word*/
#defineF_SBITS4/*formatsinglebitsintheimage*/
Ç
ACKNOWLEDGEMENT
ThefollowingpeoplecontributedtoAIM:
FransGroen(UVA/VU):someimageprocessing.
RobertdeVries(TUD):GEMinterface.
IgorWeber(UniversityofZagreb,YU):low-resolutionandcolour
display.
GertvanAntwerpen(CBD):lmin,lmax,unif,label
PietVerbeek(TUD):gaus,dog,robe,lgau,adne,adre,lgra,ggra,
sune,sure,para,sepa,peak,hara,have,low,upp,dyt,tet,dyg,teg,rag,
dyr,ter,rar,dyl,tel,ral,dys,tes,ras,dyf,tef,raf,kuwa,edgps,copy
LucasvanVlietand:erosion,dilation,propagation,
BenVerwer(TUD)skeleton
TomHoeksma(TUD):testsandevaluation.
AdHerweijer(TUD)
FransGroen
PietVerbeek
RobertdeVries
March1988
Pleasesendremarksandcommentsto:
FransGroen
FacultyofMathematicsandComputerScience
UniversityofAmsterdam
Kruislaan409
1098SJAmsterdam
TheNetherlands
email:groen@uva.uucp(....!mcvax!uva!groen)
orto:
PietVerbeek
AppliedPhysicsDepartment
DelftUniversityofTechnology
Lorentzweg1
2628CJDelft
TheNetherlands
tel(31)15-781416